package com.zhu.pre.service;

import com.sanploy.common.domain.dto.OrderDto;
import com.sanploy.common.domain.vo.OrderListVo;
import com.sanploy.common.vo.BaseException;
import com.sanploy.wechat.dto.PaySign;

import javax.servlet.ServletRequest;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.List;

/**
 * Created by zhu yingzhi on 2017/9/6.
 * @author yingzhi zhu
 * 手机订单逻辑处理接口
 */
 public interface MOrderService
{
    /**
     * 保存订单
     * @param orderDto
     * @return
     * @throws BaseException
     * @throws IOException
     * @throws NoSuchAlgorithmException
     */
     PaySign saveOrder(OrderDto orderDto) throws BaseException, IOException, NoSuchAlgorithmException;

    /**
     * 查找订单通过状态
     * @param token 请求认证
     * @param status 状态·
     * @return
     * @throws BaseException
     */
     List<OrderListVo> findOrderByStatus(String token, String status) throws BaseException;


    /**
     * 微信异步通知支付结果
     * @param servletRequest
     * @return
     * @throws IOException
     */
     String payNotify(ServletRequest servletRequest) throws IOException;

    /**
     * 通过id查找订单
     * @param token 请求认证
     * @param orderId 订单id
     * @return 订单实体VO
     * @throws BaseException
     */
     OrderListVo findOrderById(String token, String orderId) throws BaseException;

    /**
     * 订单支付
     * @param token
     * @param orderId
     * @return
     * @throws Exception
     */
     PaySign payOrder(String token, String orderId) throws Exception;

    /**
     * 订单取消
     * @param token 请求认证
     * @param orderId 订单号
     * @return
     * @throws BaseException
     */
     int cancelOrder(String token, String orderId) throws BaseException;

    /**
     * 订单确认
     * @param token 请求认证
     * @param orderId 订单号
     * @return
     * @throws BaseException
     */
     int confirmOrder(String token, String orderId) throws BaseException;
}
